package com.controller;

import java.util.List;

import com.dao.EmpresaDao;
import com.database.TransactionManager;
import com.model.EmpresaBean;

public class EmpresaController {

	public void inserir(TransactionManager transaction, String razao, String fantasia, String cnpj){
		//
		EmpresaBean bean = new EmpresaBean();
		bean.setRazao(razao);
		bean.setFantasia(fantasia);
		bean.setCnpj(cnpj);
		//
		EmpresaDao dao = new EmpresaDao();
		dao.insert(transaction, bean);

	}
	public void update(TransactionManager transaction, String razao,  String fantasia, String cnpj){
		//
		EmpresaBean bean = new EmpresaBean();
		bean.setRazao(razao);
		bean.setFantasia(fantasia);
		bean.setCnpj(cnpj);
		//
		EmpresaDao dao = new EmpresaDao();
		dao.update(transaction, bean);
	}
	public void delete(TransactionManager transaction, Integer Id){
		//
		EmpresaBean bean = new EmpresaBean();
		bean.setId(Id);
		//
		EmpresaDao dao = new EmpresaDao();
		dao.delete(transaction, bean);
	}
	public List<EmpresaBean> CotList(TransactionManager transaction){
		//
		EmpresaDao dao = new EmpresaDao();
		List<EmpresaBean> beanList = dao.getAll(transaction);
		return beanList;
	}
	
	
}
